<h1>Batch Jobs</h1>

<p class="index-page--subtitle"> This section lists all
  available batch jobs deployed with this instance of Spring Batch Admin.
</p>
<div id="batch-job-launch" class="row">
  <div class="col-md-6">
    <form novalidate class="simple-form">
      <h1>{{jobName}}</h1>
      <label class="col-md-12" for="launchRequest.name">Job Parameters</label>
      <textarea class="col-md-12" ng-model="launchRequest.jobParameters" placeholder="key=value pairs"></textarea>
      <button ng-click="launch(launchRequest)">Launch</button>
    </form>
  </div>
</div>
<div id="batch-jobs" class="tab-pane active col-md-12">
  <table ng-table="tableParams" class="table">
    <tr ng-repeat="job in $data">
      <td data-title="'Id'" class="text-center">
        <a ui-sref="jobExecution({jobName: jobName, jobInstanceId: job.instanceId})">{{job.instanceId}}</a>
      </td>
      <td data-title="'Executions'" class="text-center">
        {{job.jobExecutions.length}}
      </td>
      <td data-title="'Last Job Execution'" class="text-center">
        {{job.jobExecutions[job.jobExecutions.length - 1].exitStatus.exitCode}}
      </td>
      <td data-title="'Last Job Execution Date'" class="text-center">
        {{job.jobExecutions[job.jobExecutions.length - 1].createDate | date:'MM/dd/yyyy'}}
      </td>
      <td data-title="'Last Job Execution Start'" class="text-center">
        {{job.jobExecutions[job.jobExecutions.length - 1].startTime | date:'h:mma'}}
      </td>
      <td data-title="'Last Job Execution Duration'" class="text-center" duration start='job.jobExecutions[job.jobExecutions.length - 1].startTime' end='job.jobExecutions[job.jobExecutions.length - 1].endTime'></td>
      <td data-title="'Last Job Execution Parameters'" class="text-center">
        {{job.jobExecutions[job.jobExecutions.length - 1].jobParameters.parameters}}
      </td>
    </tr>
  </table>
</div>
